home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-02-23 | 3.0 KB | 78 lines | [TEXT/GEOL] |
- Item forwarded by A33 to A34
-
- Item 8143421 22-Feb-90 01:05PST
-
- From: CDA0004 VAR Shana Corp, Don Murphy,IVR
-
- To: MACAPP.TECH$ MacApp Technical
-
- Sub: More On UnloadAllSegs
-
- Attn: MacApp Technical
- SentBy: Wayne Malkin
- Date 2/21/90
- Subject More On UnloadAllSegs
- From Wayne Malkin
- To MacApp Technical
-
- Memo Subject:More On UnloadAllSegs
-
- Some time ago, Larry said he didn't think UnloadAllSegs and LoadSeg introduced
- much overhead, although he hadn't tried it.
-
- Well, I tried it and it does. Actually, it only makes a big difference when
- the user is doing something like typing, and things keep getting unloaded and
- loaded between each character.
-
- On that note, here are some additional ideas for UnloadAllSegs:
-
- • Don't unload if you don't have to
-
- I had a test in the LoadSeg patch to see if the segment is currently unloaded,
- and if the total of currently loaded code plus this one exceeds a specific
- limit. If so, then call UnloadAllSegs, which is careful to only unload things
- not in the current call chain.
-
- This works well, but I found that in a certain case where the user was tabbing
- from field to field on a form, slightly more than the above code limit was
- touched (and therefore loaded). I had the limit set at 220k, which was more
- than adequate, as the longest calling chain is about 140k. The tabbing code,
- however, called a total of 250k of code at some point. Therefore UnloadAllSegs
- was being called at least once during each tab.
-
- The traditional approach of re-segmenting may have worked in this case, but we
- already have 110 segments, and things are getting out of hand. Isn't there a
- limit of 255 code segments or something? Also, if you are running out of jump
- table space, splitting segments will not be a good idea.
-
- I found that this slowed things down dramatically, from the user's point of
- view. If the user held down the TAB key, it went from field to field in slow
- motion. If I broke into MacsBug and upped the limit to 250k, tabbing
- performance improved by about a factor of 4.
-
- My solution was to define another limit which represents the minimum available
- user memory. I set this to 32k, which, in addition to the 32k low memory
- reserve already in place, leaves about 64k for emergency use.
-
- The LoadSeg patch now checks if user memory is less than the 32k limit, and if
- not, doesn't unload. Things now work smoothly as long as memory is plentiful,
- and things start unloading all over the place as soon as memory gets tight.
- Works like a dream.
-
- I also modified many of the memory allocation routines to retry after calling
- UnloadAllSegs if a memory request fails. This may be needed if a request is
- made for memory that should be there but isn't because too much code is
- locked.
-
- • Writelns
-
- I also found that the writeln unit needs to be made resident, since
- WWDriver.c.o doesn't do nice stack frames, and WWSeg gets the rug pulled out
- from under it on a regular basis.
-
- That is the only problem I have had so far.
-
- -- Wayne Malkin
-
-
-